Skip to content

feat: experimental optimization of dynamic arrays#3973

Closed
sirasistant wants to merge 1 commit intomasterfrom
arv/experiment_optimize_dyn_arr
Closed

feat: experimental optimization of dynamic arrays#3973
sirasistant wants to merge 1 commit intomasterfrom
arv/experiment_optimize_dyn_arr

Conversation

@sirasistant
Copy link
Contributor

No description provided.

@sirasistant sirasistant changed the title feat: experimental optimization feat: experimental optimization of dynamic arrays Jan 12, 2024
@github-actions
Copy link
Contributor

Changes to circuit sizes

Generated at commit: 3599a500012d937e00b85e51a163ca24d749cb18, compared to commit: f3104acdb135aff00b275ba35f41cbb8cfb4c84f

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_init -11,663 ✅ -24.27% -45,467 ✅ -11.89%
rollup_base -55,441 ✅ -18.84% -221,585 ✅ -13.26%
private_kernel_inner -58,582 ✅ -38.79% -231,376 ✅ -30.70%
public_kernel_private_previous -34,847 ✅ -42.62% -136,451 ✅ -32.68%
public_kernel_public_previous -34,847 ✅ -42.63% -136,451 ✅ -32.68%
private_kernel_ordering -101,425 ✅ -34.13% -430,563 ✅ -46.33%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_init 36,399 (-11,663) -24.27% 337,069 (-45,467) -11.89%
rollup_base 238,760 (-55,441) -18.84% 1,449,334 (-221,585) -13.26%
private_kernel_inner 92,434 (-58,582) -38.79% 522,230 (-231,376) -30.70%
public_kernel_private_previous 46,913 (-34,847) -42.62% 281,066 (-136,451) -32.68%
public_kernel_public_previous 46,905 (-34,847) -42.63% 281,058 (-136,451) -32.68%
private_kernel_ordering 195,747 (-101,425) -34.13% 498,850 (-430,563) -46.33%

@AztecBot
Copy link
Collaborator

Benchmark results

Metrics with a significant change:

  • node_database_size_in_bytes (10): 3,725,202 (-30%)
Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Values are compared against data from master at commit a907c3b9 and shown if the difference exceeds 1%.

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 8 txs 32 txs 128 txs
l1_rollup_calldata_size_in_bytes 45,444 179,588 716,132
l1_rollup_calldata_gas 220,992 865,964 3,447,944
l1_rollup_execution_gas 934,136 3,968,438 24,791,480
l2_block_processing_time_in_ms 1,490 (-1%) 5,170 (+1%) 21,320 (+3%)
note_successful_decrypting_time_in_ms 319 (+4%) 964 (+2%) 3,514 (+3%)
note_trial_decrypting_time_in_ms 29.0 (+57%) 90.5 (+26%) 143 (+4%)
l2_block_building_time_in_ms 14,948 59,549 238,914
l2_block_rollup_simulation_time_in_ms 10,552 42,147 169,554
l2_block_public_tx_process_time_in_ms 4,362 17,294 69,066

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 16 txs.

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms 14,907 (-3%) 28,684 (-3%)
note_history_successful_decrypting_time_in_ms 2,182 (-3%) 4,271 (-3%)
note_history_trial_decrypting_time_in_ms 113 (-20%) 165 (-9%)
node_database_size_in_bytes 3,626,954 ⚠️ 3,725,202 (-30%)
pxe_database_size_in_bytes 29,923 59,478

Circuits stats

Stats on running time and I/O sizes collected for every circuit run across all benchmarks.

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 213 44,681 25,561
private-kernel-ordering 165 43,753 14,809
base-rollup 1,068 128,338 881
root-rollup 81.2 4,088 709
private-kernel-inner 291 71,208 25,561
public-kernel-private-input 205 31,863 25,561
public-kernel-non-first-iteration 203 31,905 25,561
merge-rollup 8.43 2,608 881

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 2 leaves 8 leaves 16 leaves 32 leaves 64 leaves 128 leaves 512 leaves 1024 leaves 2048 leaves 8192 leaves
batch_insert_into_append_only_tree_ms 11.2 (-1%) 90.8 (-22%) 13.5 (-2%) 17.7 (-2%) 25.6 (+2%) 50.3 (-1%) 89.7 (-2%) 242 (-7%) 468 (-1%) 918 3,579
batch_insert_into_indexed_tree_ms N/A N/A N/A 64.4 N/A 59.9 (+1%) 112 (+2%) 485 (-2%) 729 (-1%) 1,419 (+1%) 5,623 (+1%)

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 15,455 32,224

Transaction processing duration by data writes.

Metric 0 new commitments 1 new commitments
tx_pxe_processing_time_ms 375 (+1%) 1,085
Metric 1 public data writes
tx_sequencer_processing_time_ms 535

@sirasistant
Copy link
Contributor Author

Will apply this at the noir repo

@sirasistant
Copy link
Contributor Author

Merged on noir noir-lang/noir#4027

@ludamad ludamad deleted the arv/experiment_optimize_dyn_arr branch August 22, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants